home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 4.7 KB | 171 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWArcShp.h
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWARCSHP_H
- #define FWARCSHP_H
-
- // ----- Foundation Includes -----
-
- #ifndef FWSTDDEF_H
- #include <FWStdDef.h>
- #endif
-
- #ifndef FWSHAPE_H
- #include "FWShape.h"
- #endif
-
- #ifndef FWBNDSHP_H
- #include "FWBndShp.h"
- #endif
-
- #ifndef FWINK_H
- #include "FWInk.h"
- #endif
-
- #ifndef FWSTYLE_H
- #include "FWStyle.h"
- #endif
-
- //========================================================================================
- // •• Forward Declarations
- //========================================================================================
-
- class FW_CGraphicContext;
- class FW_CArcShapeRep;
- class FW_COvalShape;
- class FW_CRoundRectShape;
- class FW_CRectShape;
- class FW_CLineShape;
- class FW_CRegionShape;
-
- //========================================================================================
- // •• CLASS FW_CArcShape
- //========================================================================================
-
- class FW_CArcShape : public FW_CShape
- {
- //----------------------------------------------------------------------------------------
- // • Constructors
- //
- public:
- FW_CArcShape();
- FW_CArcShape(const FW_CRect& rect, short startAngle, short arcAngle);
-
- FW_CArcShape(const FW_CArcShape& other);
- FW_CArcShape(FW_CArcShapeRep* rep);
-
- //----------------------------------------------------------------------------------------
- // • Operators
- //
- public:
- FW_CArcShape& operator=(const FW_CArcShape& other);
- FW_CArcShape& operator=(FW_CArcShapeRep* other);
- FW_CArcShapeRep* operator->() const
- {return (FW_CArcShapeRep*)GetRep();}
-
- //----------------------------------------------------------------------------------------
- // • Conversion
- //
- public:
- operator FW_COvalShape() const;
- operator FW_CRoundRectShape() const;
- operator FW_CRectShape() const;
- operator FW_CLineShape() const;
- operator FW_CRegionShape() const;
-
- //----------------------------------------------------------------------------------------
- // • Static Methods
- //
- public:
- static void DrawArc(FW_CGraphicContext* graphicContext,
- const FW_CRect& rect,
- short startAngle,
- short arcAngle);
- };
-
- //========================================================================================
- // •• class FW_CArcShapeRep
- //========================================================================================
-
- class FW_CArcShapeRep : public FW_CBoundedShapeRep
- {
- friend class FW_CArcShape;
-
- //----------------------------------------------------------------------------------------
- // • Constructors/Destructors
- //
- protected:
- FW_CArcShapeRep();
- FW_CArcShapeRep(const FW_CRect& rect, short startAngle, short arcAngle);
-
- virtual ~FW_CArcShapeRep();
-
- //----------------------------------------------------------------------------------------
- // • Inherited API
- //
- public:
- // ----- Rendering -----
- virtual void Draw(FW_CGraphicContext* graphicContext);
- static void DrawArc(FW_CGraphicContext* graphicContext,
- const FW_CRect& rect,
- short startAngle,
- short arcAngle);
-
- // ----- Hit Testing -----
- virtual FW_HitTestPart HitTest(const FW_CPoint& test) const;
-
- // ----- Default shape -----
- virtual void SetAsDefault() const;
-
- // ----- Stream -----
- virtual void Flatten(FW_CWritableStream& stream);
- virtual void Unflatten(FW_CReadableStream& stream);
-
- //----------------------------------------------------------------------------------------
- // • New API
- //
- public:
- FW_CArcShape Copy() const;
-
- short GetStartAngle() const
- {return fStartAngle;}
- void SetStartAngle(short angle)
- {fStartAngle = angle; Changed();}
-
- short GetArcAngle() const
- {return fArcAngle;}
- void SetArcAngle(short angle)
- {fArcAngle = angle; Changed();}
-
- //----------------------------------------------------------------------------------------
- // • Data Members
- //
- private:
- short fStartAngle;
- short fArcAngle;
- };
-
- //========================================================================================
- // •• Inlines
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // • FW_CArcShape::DrawArc
- //----------------------------------------------------------------------------------------
- inline static void FW_CArcShape::DrawArc(FW_CGraphicContext* graphicContext,
- const FW_CRect& rect,
- short startAngle,
- short arcAngle)
- {
- FW_CArcShapeRep::DrawArc(graphicContext, rect, startAngle, arcAngle);
- }
-
- #endif